using UnityEngine;
using QFramework;
using UnityEngine.SceneManagement;

namespace AsterroidX
{
	public partial class UIGameOver : ViewController,IController
	{
        private void OnEnable()
        {
            this.SendCommand(new SetPauseCmd(true));
        }

        private void Start()
        {
            BtnRestart.onClick.AddListener(() =>
            {
                BtnRestart.onClick.RemoveAllListeners();

                AudioKit.PlaySound("resources://sfx_click");

                ActionKit.ScreenTransition.FadeInOut()
                .In(setIn => setIn.Duration(0.5f))
                .Out(setOut => setOut.Duration(0.5f))
                .OnInFinish(() =>
                {
                    SceneManager.LoadScene("Game");
                }).StartGlobal();
            });

            BtnHome.onClick.AddListener(() =>
            {
                BtnHome.onClick.RemoveAllListeners();

                AudioKit.PlaySound("resources://sfx_click");

                ActionKit.ScreenTransition.FadeInOut()
                .OnInFinish(() =>
                {
                    SceneManager.LoadScene("Home");
                }).StartGlobal();


            });
        }
        private void OnDisable()
        {
            this.SendCommand(new SetPauseCmd(false));
        }

        public IArchitecture GetArchitecture()
        {
            return GameApp.Interface;
        }
    }
}
